<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>设置或检索阻塞信号</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.pcntl-sigprocmask" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">pcntl_sigprocmask</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.3.0, PHP 7)</p><p class="refpurpose"><span class="refname">pcntl_sigprocmask</span> &mdash; <span class="dc-title">设置或检索阻塞信号</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.pcntl-sigprocmask-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>pcntl_sigprocmask</strong></span>
    ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$how</code></span>
   , <span class="methodparam"><span class="type">array</span> <code class="parameter">$set</code></span>
   [, <span class="methodparam"><span class="type">array</span> <code class="parameter reference">&$oldset</code></span>
  ] ) : <span class="type">bool</span></div>

  <p class="para rdfs-comment">
   函数<span class="function"><strong>pcntl_sigprocmask()</strong></span>用来增加，删除或设置阻塞信号，具体行为
   依赖于参数<code class="parameter">how</code>。 
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.pcntl-sigprocmask-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<code class="parameter">how</code></dt>

     <dd>

      <p class="para">
       设置<span class="function"><strong>pcntl_sigprocmask()</strong></span>函数的行为。 可选值: 
       <ul class="simplelist">
        <li class="member"><strong><code>SIG_BLOCK</code></strong>: 把信号加入到当前阻塞信号中。</li>
        <li class="member"><strong><code>SIG_UNBLOCK</code></strong>: 从当前阻塞信号中移出信号。</li>
        <li class="member"><strong><code>SIG_SETMASK</code></strong>: 用给定的信号列表替换当前阻塞信号列表。</li>
       </ul>
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">set</code></dt>

     <dd>

      <p class="para">
       信号列表。
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">oldset</code></dt>

     <dd>

      <p class="para">
       <code class="parameter">oldset</code>是一个输出参数，用来返回之前的阻塞信号列表数组。
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.pcntl-sigprocmask-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   成功时返回 <strong><code>TRUE</code></strong>， 或者在失败时返回 <strong><code>FALSE</code></strong>。
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.pcntl-sigprocmask-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-4329">
    <p><strong>Example #1 <span class="function"><strong>pcntl_sigprocmask()</strong></span> 示例</strong></p>
    <div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">//将SIGHUP信号加入到阻塞信号中<br /></span><span style="color: #0000BB">pcntl_sigprocmask</span><span style="color: #007700">(</span><span style="color: #0000BB">SIG_BLOCK</span><span style="color: #007700">,&nbsp;array(</span><span style="color: #0000BB">SIGHUP</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">$oldset&nbsp;</span><span style="color: #007700">=&nbsp;array();<br /></span><span style="color: #FF8000">//将SIGHUP从阻塞信号列表中移除并返回之前的阻塞信号列表。<br /></span><span style="color: #0000BB">pcntl_sigprocmask</span><span style="color: #007700">(</span><span style="color: #0000BB">SIG_UNBLOCK</span><span style="color: #007700">,&nbsp;array(</span><span style="color: #0000BB">SIGHUP</span><span style="color: #007700">),&nbsp;</span><span style="color: #0000BB">$oldset</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.pcntl-sigprocmask-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="pcntl_sigwaitinfo.html" class="function" rel="rdfs-seeAlso">pcntl_sigwaitinfo()</a> - 等待信号</span></li>
    <li class="member"><span class="function"><a href="pcntl_sigtimedwait.html" class="function" rel="rdfs-seeAlso">pcntl_sigtimedwait()</a> - 带超时机制的信号等待</span></li>
   </ul>
  </p>
 </div>


</div></div></div></body></html>